package com.fuxi.cloud.desreport.render.handler;

import com.alibaba.fastjson.JSONObject;
import com.fuxi.cloud.desreport.model.RenderInfo;
import com.fuxi.cloud.desreport.model.ReportDbInfo;
import com.fuxi.cloud.desreport.render.utils.RegexMatches;

/**
 * RowsRenderHandler
 *
 * @Author: 扫地僧
 * @CreateTime: 2021-05-03
 */
public interface RowsRenderHandler {
    boolean support(RenderInfo var1, JSONObject var2);

    default String getTemplate(String content, Integer rowKey, String dataSetKey, JSONObject currentRow, JSONObject lastRow) {
        return null;
    }

    JSONObject render(RenderInfo var1, JSONObject var2);

    Object getData(ReportDbInfo var1);

    default String getDataSetKey(String text) {
        return RegexMatches.a(text, 1);
    }

    default JSONObject afterRender(RenderInfo renderInfo, JSONObject row, JSONObject dynamicRowObj, Integer dynamicRowEndIndex) {
        return dynamicRowObj;
    }
}

